const rimraf = require('rimraf');

const clearDist = (dir) => {
    if(!dir) return new Error('current operating direction error !');
    return new Promise((resolve, reject) => {
        rimraf(dir, (err) => {
            if(err) return reject({ code : -1, data: 'clear dist error !'});
            resolve({ code: 1, data: 'clear dist successfully !'})
        })
    })
}

module.exports = clearDist;